import java.util.Scanner;

public class test12 {
    public static void main(String[] args) {
        String registName = " ";
        String registPsw = " ";
        System.out.println("注册");
        Scanner input = new Scanner(System.in);
        System.out.println("请输入用户名：");
        registName = input.next();
        System.out.println("请输入密码：");
        registPsw = input.next();
        System.out.println("注册成功！");
        int vipNum = (int)(Math.random()*9000+1000);

        //登录
        System.out.println("登录");
        System.out.println("请输入用户名：");
        String loginName = input.next();
        System.out.println("请输入密码：");
        String loginPsd = input.next();


        int luckyNums=0;
        if (registName.equals(loginName) && registPsw.equals(loginPsd)){
            System.out.println("登录成功！");
            System.out.println("抽奖");
            System.out.println("幸运数字是：");
            for (int i =0;i<6;i++){
                luckyNums = (int)(Math.random()*9000+1000);
                System.out.print(luckyNums+"\t");
            }
            System.out.println("你的数字是"+vipNum);

            boolean flag = false ;
            for (int i =0;i<6;i++){
                if (vipNum==luckyNums){
                    flag= true ;
                }
            }
                if (flag){
                    System.out.println("中奖");
                }else {
                    System.out.println("没中奖");
                }
        }else {
            System.out.println("用户名或密码错误！");
        }

    }
}
